/*
 * Tree.h
 *
 *  Created on: 07/07/2012
 *      Author: marcio
 */

#ifndef TREE_H_
#define TREE_H_
#include "List.h"

typedef struct _node{
	void* elem;
	List* childs;
	int size;
	int lvl;
}TreeNode;

typedef struct _tree{
	TreeNode* root;
	int height;
	int size;
}Tree;

TreeNode* treenode_newNode(TreeNode* node, void* elem);

int treenode_addToChild(TreeNode* node, TreeNode* child);

Tree* tree_newTree(TreeNode* root);

void tree_add(Node* elem, Node* nodetree);

int tree_getSize(Tree* t);

TreeNode** tree_BFS(Tree* t);

TreeNode** tree_DFS(Tree* t);

TreeNode* binarytree_BFSOnlyLeafs(Tree* t);

TreeNode* binarytree_DFSOnlyLeafs(Tree* t);

int tree_BFSModify(Tree* t,int (f)(void*));

int tree_DFSModify(Tree* t,int (f)(void*));

#endif /* TREE_H_ */
